﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AgentMain.aspx.cs" Inherits="CRM_Project.AgentMain" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Vehicle Search</title>
    </head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <h2>Vehicle Search</h2>
        <p>
                <a href="AgentReservations.aspx">Reservations</a></p>
        <p>
                <asp:Label ID="carID_label" runat="server" Text="Internal ID :"></asp:Label>
                            <asp:TextBox ID="carID_textbox" runat="server" Width="128px"></asp:TextBox>
                            <br />
                            <asp:Label ID="model_label" runat="server" Text="Model :"></asp:Label>
                            <asp:TextBox ID="model_textbox" runat="server"></asp:TextBox>
                            <br />
                            <asp:Label ID="lot_label" runat="server" Text="Lot :"></asp:Label>
                            <asp:TextBox ID="lot_textbox" runat="server" Width="128px"></asp:TextBox>
                            <br />
                            <asp:Label ID="status_label" runat="server" Text="Status :"></asp:Label>
                            <asp:TextBox ID="status_textbox" runat="server"></asp:TextBox>
        </p>
        <p>
                            <asp:Button ID="search_button" runat="server" onclick="search_button_Click" 
                                Text="Search" />
        </p>
    </div>
                <asp:GridView ID="vehicle_gridview" runat="server" 
        AutoGenerateColumns="False" DataSourceID="LinqDataSource1">
                    <Columns>
                        <asp:HyperLinkField DataNavigateUrlFields="ID" 
                            DataNavigateUrlFormatString="~/UpdateVehicle.aspx?VehicleID={0}" 
                            Text="Update" />
                        <asp:BoundField HeaderText="ID" DataField="ID" ReadOnly="True" />
                        <asp:BoundField HeaderText="Model" DataField="ModelName" ReadOnly="true" />
                        <asp:BoundField HeaderText="Status" DataField="StatusCode" ReadOnly="true" />
                        <asp:BoundField HeaderText="Lot" DataField="LotName" ReadOnly="true" />
                    </Columns>
                </asp:GridView>
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
        ContextTypeName="CRM_Project.crmengine" Select="new (ID, Status.Description as StatusCode, Model.Name as ModelName, Lot.Name as LotName)" 
        TableName="Cars">
    </asp:LinqDataSource>
    </form>
    </body>
</html>
